Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | export function hslaString(hslcolor) { |
||
18 | export function rgbaString(hexcolor) { |
||
19 | if (hexcolor.a) { |
||
20 | return ( |
||
21 | "rgba(" + |
||
22 | hexcolor.r + |
||
23 | "," + |
||
24 | hexcolor.g + |
||
25 | "," + |
||
26 | hexcolor.b + |
||
27 | "," + |
||
28 | hexcolor.a + |
||
29 | ")" |
||
30 | ); |
||
31 | } |
||
32 | return "rgb(" + hexcolor.r + "," + hexcolor.g + "," + hexcolor.b + ")"; |
||
33 | } |
||
34 | |||
67 |
When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically: